/*
 Navicat Premium Data Transfer

 Source Server         : localhost_3306
 Source Server Type    : MySQL
 Source Server Version : 80019
 Source Host           : localhost:3306
 Source Schema         : timesblog

 Target Server Type    : MySQL
 Target Server Version : 80019
 File Encoding         : 65001

 Date: 20/05/2020 11:53:05
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for admin
-- ----------------------------
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '用户主键',
  `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '头像地址',
  `username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '用户名',
  `password` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '密码',
  `email` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '邮箱',
  `nickname` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '昵称',
  `note` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '个人简介',
  `gmt_create` date DEFAULT NULL COMMENT '创建时间',
  `gmt_modified` date DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of admin
-- ----------------------------
BEGIN;
INSERT INTO `admin` VALUES (1, 'avator', 'sdl', '$2a$10$z5/TF35QNgFueBQ.UC.CieI5Qd6HNJTykV9ozfD3QCg2n0tNXfj6a', 'sdl-life@foxmai.com', '白云的离殇', 'Talk is cheap.Show me the Code!', '2020-05-10', '2020-05-10');
COMMIT;

-- ----------------------------
-- Table structure for blog
-- ----------------------------
DROP TABLE IF EXISTS `blog`;
CREATE TABLE `blog` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
  `title` varchar(255) DEFAULT NULL COMMENT '标题',
  `image` varchar(255) DEFAULT NULL COMMENT '图片',
  `context` text COMMENT '内容',
  `sort` int DEFAULT NULL COMMENT '排序',
  `gmt_create` datetime DEFAULT NULL COMMENT '创建时间',
  `gmt_modified` datetime DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of blog
-- ----------------------------
BEGIN;
INSERT INTO `blog` VALUES (23, 'Springboot集成PageHeaper分页', NULL, '<p>1.首先在maven中添加pageheaper依赖</p>\n<pre><code class=\"lang-\">        &lt;dependency&gt;\n            &lt;groupId&gt;com.github.pagehelper&lt;/groupId&gt;\n            &lt;artifactId&gt;pagehelper-spring-boot-starter&lt;/artifactId&gt;\n            &lt;version&gt;1.2.13&lt;/version&gt;\n        &lt;/dependency&gt;\n</code></pre>\n<p>2.添加返回数据的业务代码</p>\n<pre><code class=\"lang-\">  /**\n     * 查看所有商品\n     * @param productInfo\n     * @return\n     */\n    List&lt;ProductInfo&gt; queryAll(ProductInfo productInfo);\n</code></pre>\n<p>所用到查询的sql语句：</p>\n<pre><code class=\"lang-\">  &lt;select id=&quot;queryAll&quot; resultMap=&quot;ProductInfoMap&quot;&gt;\n        select\n          product_id, product_name, product_price, product_stock, product_description, product_icon, category_type, create_time, update_time, product_status\n        from elm.product_info\n        &lt;where&gt;\n            &lt;if test=&quot;productId != null&quot;&gt;\n                and product_id  like concat(\'%\', #{productId}, \'%\')\n            &lt;/if&gt;\n            &lt;if test=&quot;productName != null and productName != \'\'&quot;&gt;\n                and product_name like concat(\'%\', #{productName}, \'%\')\n            &lt;/if&gt;\n            &lt;if test=&quot;productDescription != null and productDescription != \'\'&quot;&gt;\n                and product_description like concat(\'%\', #{productDescription}, \'%\')\n            &lt;/if&gt;\n        &lt;/where&gt;\n    &lt;/select&gt;\n</code></pre>\n<p>3.在Controller中使用</p>\n<pre><code class=\"lang-\">    @ApiOperation(value = &quot;获取所有商品&quot;, notes = &quot;可选参数pageNum:当前页码，默认为1，可选参数pageSize:页面大小，默认为6;&quot;)\n    @GetMapping(&quot;/getall&quot;)\n    public Result getall(@RequestParam(required = false,defaultValue = &quot;1&quot;) Integer pageNum,\n                         @RequestParam(required = false,defaultValue = &quot;6&quot;) Integer pageSize) {\n        PageHelper.startPage(pageNum,pageSize);\n        List&lt;ProductInfo&gt; list = productInfoService.queryAll(null);\n        PageInfo&lt;ProductInfo&gt; pageInfo = new PageInfo&lt;&gt;(list);\n        return Result.success(pageInfo);\n    }\n</code></pre>\n<p>4.返回结果<br />\n返回参数介绍</p>\n<pre><code class=\"lang-\">     //当前页\n    private int pageNum;\n    //每页的数量\n    private int pageSize;\n    //当前页的数量\n    private int size;\n    //由于startRow和endRow不常用，这里说个具体的用法\n    //可以在页面中&quot;显示startRow到endRow 共size条数据&quot;\n    //当前页面第一个元素在数据库中的行号\n    private int startRow;\n    //当前页面最后一个元素在数据库中的行号\n    private int endRow;\n    //总记录数\n    private long total;\n    //总页数\n    private int pages;\n    //结果集(每页显示的数据)\n    private List&lt;T&gt; list;\n    //第一页\n    private int firstPage;\n    //前一页\n    private int prePage;\n    //是否为第一页\n    private boolean isFirstPage = false;\n    //是否为最后一页\n    private boolean isLastPage = false;\n    //是否有前一页\n    private boolean hasPreviousPage = false;\n    //是否有下一页\n    private boolean hasNextPage = false;\n    //导航页码数\n    private int navigatePages;\n    //所有导航页号\n    private int[] navigatepageNums;\n</code></pre>\n<p>本实例结果<br />\n<img src=\"https://upload-images.jianshu.io/upload_images/7766137-4da2da7eeb940b78.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240\" alt=\"返回结果\" /></p>\n', NULL, '2020-05-03 00:00:00', '2020-05-03 00:00:00');
INSERT INTO `blog` VALUES (25, '这是一个测试', NULL, '测试测试测试', NULL, '2020-05-13 00:00:00', NULL);
INSERT INTO `blog` VALUES (27, 'Docker部署MySql', NULL, '1.搜索mysql镜像。\n\n```\ndocker search mysql\n```\n![截屏2020-03-12下午1.36.51.png](https://segmentfault.com/img/bVbEq3a)\n\n2.选择一个版本安装。\n```\ndocker pull mysql:5.7\n```\n![截屏2020-03-12下午1.40.04.png](/img/bVbEq4v)\n\n3.查看docker镜像\n```\ndocker images\n```\n![截屏2020-03-12下午1.55.03.png](/img/bVbEq7J)\n\n4.运行实例\n```\ndocker run --name mysql5.7 -p 3306:3306 -e  MYSQL\\_ROOT\\_PASSWORD=123456 -d mysql:5.7\n```\n> \n> --restart=always   设置Docker启动后自动运行\n> \n> --name mysql5.7  此容器的别名\n> \n> -p 3306:3306  前面是暴露出去的端口，后面是容器内部的服务端口\n> \n> \n> -e MYSQL\\_ROOT\\_PASSWORD   root用户的密码\n> \n> -d mysql:5.7   mysql的版本\n\n测试连接\n![截屏2020-03-12下午2.07.30.png](/img/bVbEq9J)', NULL, '2020-05-19 04:23:05', NULL);
INSERT INTO `blog` VALUES (28, 'Markdown 语法简介', NULL, '@[toc](目录)\n\nMarkdown 语法简介\n=============\n> [语法详解](http://commonmark.org/help/)\n\n## **粗体**\n```\n**粗体**\n__粗体__\n```\n## *斜体*\n```\n*斜体*\n_斜体_\n```\n## 标题\n```\n# 一级标题 #\n一级标题\n====\n## 二级标题 ##\n二级标题\n----\n### 三级标题 ###\n#### 四级标题 ####\n##### 五级标题 #####\n###### 六级标题 ######\n```\n## 分割线\n```\n***\n---\n```\n****\n## ^上^角~下~标\n```\n上角标 x^2^\n下角标 H~2~0\n```\n## ++下划线++ ~~中划线~~\n```\n++下划线++\n~~中划线~~\n```\n## ==标记==\n```\n==标记==\n```\n## 段落引用\n```\n> 一级\n>> 二级\n>>> 三级\n...\n```\n\n## 列表\n```\n有序列表\n1.\n2.\n3.\n...\n无序列表\n-\n-\n...\n```\n\n## 任务列表\n\n- [x] 已完成任务\n- [ ] 未完成任务\n\n```\n- [x] 已完成任务\n- [ ] 未完成任务\n```\n\n## 链接\n```\n[链接](www.baidu.com)\n![图片描述](http://www.image.com)\n```\n## 代码段落\n\\``` type\n\n代码段落\n\n\\```\n\n\\` 代码块 \\`\n\n```c++\nint main()\n{\n    printf(\"hello world!\");\n}\n```\n`code`\n## 表格(table)\n```\n| 标题1 | 标题2 | 标题3 |\n| :--  | :--: | ----: |\n| 左对齐 | 居中 | 右对齐 |\n| ---------------------- | ------------- | ----------------- |\n```\n| 标题1 | 标题2 | 标题3 |\n| :--  | :--: | ----: |\n| 左对齐 | 居中 | 右对齐 |\n| ---------------------- | ------------- | ----------------- |\n## 脚注(footnote)\n```\nhello[^hello]\n```\n\n见底部脚注[^hello]\n\n[^hello]: 一个注脚\n\n## 表情(emoji)\n[参考网站: https://www.webpagefx.com/tools/emoji-cheat-sheet/](https://www.webpagefx.com/tools/emoji-cheat-sheet/)\n```\n:laughing:\n:blush:\n:smiley:\n:)\n...\n```\n:laughing::blush::smiley::)\n\n## $\\KaTeX$公式\n\n我们可以渲染公式例如：$x_i + y_i = z_i$和$\\sum_{i=1}^n a_i=0$\n我们也可以单行渲染\n$$\\sum_{i=1}^n a_i=0$$\n具体可参照[katex文档](http://www.intmath.com/cg5/katex-mathjax-comparison.php)和[katex支持的函数](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)以及[latex文档](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference)\n\n## 布局\n\n::: hljs-left\n`::: hljs-left`\n`居左`\n`:::`\n:::\n\n::: hljs-center\n`::: hljs-center`\n`居中`\n`:::`\n:::\n\n::: hljs-right\n`::: hljs-right`\n`居右`\n`:::`\n:::\n\n## 定义\n\n术语一\n\n:   定义一\n\n包含有*行内标记*的术语二\n\n:   定义二\n\n        {一些定义二的文字或代码}\n\n    定义二的第三段\n\n```\n术语一\n\n:   定义一\n\n包含有*行内标记*的术语二\n\n:   定义二\n\n        {一些定义二的文字或代码}\n\n    定义二的第三段\n\n```\n\n## abbr\n*[HTML]: Hyper Text Markup Language\n*[W3C]:  World Wide Web Consortium\nHTML 规范由 W3C 维护\n```\n*[HTML]: Hyper Text Markup Language\n*[W3C]:  World Wide Web Consortium\nHTML 规范由 W3C 维护\n```\n\n', NULL, '2020-05-19 09:17:44', NULL);
COMMIT;

-- ----------------------------
-- Table structure for blog_cate
-- ----------------------------
DROP TABLE IF EXISTS `blog_cate`;
CREATE TABLE `blog_cate` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `blogid` int DEFAULT NULL COMMENT '博客ID',
  `cateid` int DEFAULT NULL COMMENT '分类ID',
  PRIMARY KEY (`id`),
  KEY `blogid` (`blogid`),
  KEY `blog_cate_ibfk_2` (`cateid`),
  CONSTRAINT `blog_cate_ibfk_1` FOREIGN KEY (`blogid`) REFERENCES `blog` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `blog_cate_ibfk_2` FOREIGN KEY (`cateid`) REFERENCES `category` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of blog_cate
-- ----------------------------
BEGIN;
INSERT INTO `blog_cate` VALUES (24, 23, 16);
INSERT INTO `blog_cate` VALUES (26, 25, 19);
INSERT INTO `blog_cate` VALUES (28, 27, 16);
INSERT INTO `blog_cate` VALUES (29, 28, 26);
COMMIT;

-- ----------------------------
-- Table structure for blog_tag
-- ----------------------------
DROP TABLE IF EXISTS `blog_tag`;
CREATE TABLE `blog_tag` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `blogid` int DEFAULT NULL COMMENT '博客ID',
  `tagid` int DEFAULT NULL COMMENT '标签ID',
  PRIMARY KEY (`id`),
  KEY `blogid` (`blogid`),
  KEY `blog_tag_ibfk_2` (`tagid`),
  CONSTRAINT `blog_tag_ibfk_1` FOREIGN KEY (`blogid`) REFERENCES `blog` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `blog_tag_ibfk_2` FOREIGN KEY (`tagid`) REFERENCES `tag` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of blog_tag
-- ----------------------------
BEGIN;
INSERT INTO `blog_tag` VALUES (41, 23, 22);
INSERT INTO `blog_tag` VALUES (42, 23, 24);
INSERT INTO `blog_tag` VALUES (43, 23, 26);
INSERT INTO `blog_tag` VALUES (46, 25, 22);
INSERT INTO `blog_tag` VALUES (47, 25, 24);
INSERT INTO `blog_tag` VALUES (50, 27, 24);
INSERT INTO `blog_tag` VALUES (51, 28, 22);
COMMIT;

-- ----------------------------
-- Table structure for category
-- ----------------------------
DROP TABLE IF EXISTS `category`;
CREATE TABLE `category` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '分类名',
  `icon` varchar(255) DEFAULT NULL COMMENT '图标',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of category
-- ----------------------------
BEGIN;
INSERT INTO `category` VALUES (16, 'JAVA后端', NULL);
INSERT INTO `category` VALUES (19, '前端Html', NULL);
INSERT INTO `category` VALUES (26, '666', NULL);
COMMIT;

-- ----------------------------
-- Table structure for tag
-- ----------------------------
DROP TABLE IF EXISTS `tag`;
CREATE TABLE `tag` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '标签名',
  `icon` varchar(255) DEFAULT NULL COMMENT '图标地址',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of tag
-- ----------------------------
BEGIN;
INSERT INTO `tag` VALUES (22, 'SpringBoot', NULL);
INSERT INTO `tag` VALUES (24, 'MyBatis Plus', 'plus 666');
INSERT INTO `tag` VALUES (26, 'PageHelper', NULL);
INSERT INTO `tag` VALUES (32, '666', NULL);
INSERT INTO `tag` VALUES (33, '6', NULL);
INSERT INTO `tag` VALUES (34, '66666', NULL);
INSERT INTO `tag` VALUES (35, '6666666', NULL);
INSERT INTO `tag` VALUES (36, '草泥马', NULL);
COMMIT;

-- ----------------------------
-- Table structure for uploadfile
-- ----------------------------
DROP TABLE IF EXISTS `uploadfile`;
CREATE TABLE `uploadfile` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `filename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '文件名',
  `filepath` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '文件路径',
  `filetype` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '文件类型',
  `gmt_create` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '上传时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=78 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of uploadfile
-- ----------------------------
BEGIN;
INSERT INTO `uploadfile` VALUES (76, 'download', '/profile/2020-05-17/d18d9bc2-3041-4066-8ee7-76696c1c3693.gif', 'gif', '2020-05-17 07:13:50');
INSERT INTO `uploadfile` VALUES (77, 'timesblog', '/profile/2020-05-18/06443aa3-33d8-4df6-9994-7411e203a969.sql', 'sql', '2020-05-17 22:46:27');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
